// 系统配置
export interface SystemConfig {
  siteName: string
  siteLogo: string
  siteUrl: string
  siteIcp: string
  siteCopyright: string
  siteKeywords: string
  siteDescription: string
  memberDefaultAvatar: string
  enabledMemberRegister: 0 | 1
  enabledMemberEmailActive: 0 | 1
  enabledMemberSmsLogin: 0 | 1
  enabledMemberWechatLogin: 0 | 1
  enabledMemberQQLogin: 0 | 1
  enabledMemberGithubLogin: 0 | 1
  enabledMemberGiteeLogin: 0 | 1
  enabledMemberDingdingLogin: 0 | 1
  enabledMemberFeishuLogin: 0 | 1
  enabledMemberLdapLogin: 0 | 1
  enabledMemberCaptcha: 0 | 1
  memberRegisterProtocol: string
  memberRegisterPrivacyProtocol: string
}

// 应用配置
export interface AppConfig {
  name: string
  version: string
  logo: string
  favicon: string
  theme: 'light' | 'dark'
  primaryColor: string
  layout: 'side' | 'top' | 'mix'
  fixedHeader: boolean
  fixedSidebar: boolean
  multiTab: boolean
  keepAlive: boolean
  watermark: boolean
  grayMode: boolean
  colorWeak: boolean
}

// LDAP配置
export interface LdapConfig {
  enabled: 0 | 1
  url: string
  baseDn: string
  adminDn: string
  adminPass: string
  filter: string
  mapping: {
    name: string
    email: string
    mobile: string
  }
  syncEnabled: 0 | 1
  syncCron: string
}

// 缓存信息
export interface CacheInfo {
  redis: {
    version: string
    mode: string
    port: number
    maxMemory: string
    usedMemory: string
    memoryUsage: number
    connectedClients: number
    totalCommandsProcessed: number
    keyspaceHits: number
    keyspaceMisses: number
    hitRate: number
  }
  application: {
    totalKeys: number
    userSessions: number
    apiCache: number
    configCache: number
    permissionCache: number
  }
}

// 系统信息
export interface SystemInfo {
  os: {
    name: string
    arch: string
    version: string
    hostname: string
    uptime: number
  }
  java: {
    version: string
    vendor: string
    home: string
    maxMemory: number
    totalMemory: number
    freeMemory: number
    usedMemory: number
    memoryUsage: number
  }
  disk: {
    total: number
    free: number
    used: number
    usage: number
  }
  database: {
    type: string
    version: string
    url: string
    maxConnections: number
    activeConnections: number
    idleConnections: number
  }
}

// 操作日志
export interface OperationLog {
  id: string
  userId: string
  username: string
  module: string
  action: string
  method: string
  url: string
  params: string
  result: string
  exception: string
  ip: string
  location: string
  userAgent: string
  duration: number
  createdAt: string
}

// 登录日志
export interface LoginLog {
  id: string
  userId: string
  username: string
  ip: string
  location: string
  userAgent: string
  browser: string
  os: string
  status: 0 | 1 // 0-失败 1-成功
  message: string
  createdAt: string
}

// 系统监控数据
export interface MonitorData {
  cpu: {
    usage: number
    cores: number
    loadAverage: number[]
  }
  memory: {
    total: number
    used: number
    free: number
    usage: number
  }
  disk: {
    total: number
    used: number
    free: number
    usage: number
    readSpeed: number
    writeSpeed: number
  }
  network: {
    uploadSpeed: number
    downloadSpeed: number
    totalUpload: number
    totalDownload: number
  }
  jvm: {
    maxMemory: number
    totalMemory: number
    freeMemory: number
    usedMemory: number
    memoryUsage: number
    gcCount: number
    gcTime: number
  }
  timestamp: number
}

// 数据库备份信息
export interface DatabaseBackup {
  id: string
  filename: string
  size: number
  path: string
  type: 'manual' | 'auto'
  status: 'running' | 'success' | 'failed'
  message: string
  createdAt: string
  completedAt?: string
}

// 邮件配置
export interface EmailConfig {
  enabled: 0 | 1
  host: string
  port: number
  username: string
  password: string
  fromName: string
  fromEmail: string
  encryption: 'none' | 'ssl' | 'tls'
  timeout: number
}

// 短信配置
export interface SmsConfig {
  enabled: 0 | 1
  provider: 'aliyun' | 'tencent' | 'huawei'
  accessKeyId: string
  accessKeySecret: string
  signName: string
  templates: {
    login: string
    register: string
    resetPassword: string
    bindMobile: string
  }
}

// 存储配置
export interface StorageConfig {
  default: 'local' | 'aliyun' | 'tencent' | 'qiniu' | 'minio'
  local: {
    root: string
    domain: string
  }
  aliyun: {
    accessKeyId: string
    accessKeySecret: string
    bucket: string
    endpoint: string
    domain: string
  }
  tencent: {
    secretId: string
    secretKey: string
    bucket: string
    region: string
    domain: string
  }
  qiniu: {
    accessKey: string
    secretKey: string
    bucket: string
    domain: string
  }
  minio: {
    endpoint: string
    accessKey: string
    secretKey: string
    bucket: string
    domain: string
  }
}

// 支付配置
export interface PaymentConfig {
  enabled: 0 | 1
  alipay: {
    enabled: 0 | 1
    appId: string
    privateKey: string
    publicKey: string
    signType: string
    gatewayUrl: string
  }
  wechat: {
    enabled: 0 | 1
    appId: string
    mchId: string
    key: string
    certPath: string
    keyPath: string
  }
}

// 系统统计
export interface SystemStatistics {
  users: {
    total: number
    active: number
    new: number
    online: number
  }
  courses: {
    total: number
    published: number
    new: number
  }
  resources: {
    total: number
    size: number
    new: number
  }
  orders: {
    total: number
    amount: number
    new: number
  }
  visits: {
    today: number
    yesterday: number
    total: number
  }
  growth: Array<{
    date: string
    users: number
    courses: number
    orders: number
    visits: number
  }>
}